// @ts-ignore
import { useModel } from 'umi';
import { Button, Tooltip } from 'antd';
import { useEffect, useState, useRef, useMemo } from 'react';
import {
  ProFormText,
  ProFormSelect,
  ProFormDependency,
  ProForm,
  ProFormDigit,
  ProFormRadio,
  ProFormTextArea,
  ProFormCheckbox,
  ProFormTimePicker,
  ProFormDateTimeRangePicker,
} from '@ant-design/pro-components';
import useDetailType from '@/hooks/useDetailType';
import StorageManager from '../../../../utils/StorageManager';
import { isEmpty } from 'lodash';
import type { ProFormInstance } from '@ant-design/pro-components';
import { queryOptionsUsemarketingList } from '@/services/profile';

import useDispatcher from '../hooks/useDispatcher';
import getProFileData from '../getProFileData';
import {
  ENUM_PLACE_TYPE,
  ENUM_COUNT_SHOW_TYPE,
  ENUM_VALID_THRU_RULE,
  ENUM_USE_RULE_TYPE_NAME,
  ENUM_SALES_TYPE,
  ENUM_TENDER_TYPE_DESC,
  ENUM_IS_DYNAMIC_COUPON,
  ENUM_IS_EXPANDED,
  ENU_PLACE_RULE,
  ENU_IS_REAL_TIME,
  ENU_CROSS_BRAND_PLACE,
  ENU_DWEEK_LIMIT,
  ENUM_RULE_ID,
  ENUM_RULE_ID_MORE,
} from '../constants';
import Config from '../configGroup';
import FormList from './formList';
import styles from './style.less';

interface IParams {
  type?: string;
  id?: string;
}

type Props = {
  isModify?: boolean;
  isRead?: boolean;
  formRef: ProFormInstance | any;
};

const WriteOff: React.FC<Props> = ({ isModify, isRead, formRef }) => {
  //   const formInstance = ProForm.useFormInstance();
  const { initialState } = useModel('@@initialState');
  const { params } = useDetailType<IParams>();
  const isFirst = useRef(true);
  const dispatch = useDispatcher();
  const {
    formValue,
    OptionsUsetabList,
    OptionsNotifyRuleList,
    OptionsStoreGrouplist,
    OptionsDategroupList,
  } = getProFileData();

  const eunmList: any = StorageManager.getLocalStorageSync('eunmList');
  const PACKAGELIMIT = eunmList?.PACKAGELIMIT || [];
  const PRICELIMIT = eunmList?.PRICELIMIT || [];
  const ORDERLIMIT = eunmList?.ORDERLIMIT || [];
  const OFFERRESET = eunmList?.OFFERRESET || [];
  const REUSAVLETYPE = eunmList?.REUSAVLETYPE || [];
  const ZMTYPE = eunmList?.ZMTYPE || [];
  const STYPE = eunmList?.STYPE || [];
  const OptionsChannelList = eunmList?.OptionsChannelList || [];
  const OptionsPlaceBrandList = eunmList?.OptionsPlaceBrandList || [];

  const [personLimitDisabled, setPersonLimitDisabled] = useState(false);
  const [OptionsUsemarketingListOne, setOptionsUsemarketingListOne] = useState(
    [] as API.OptionsKeys[],
  ); // 限制使用规则明细--枚举
  const [OptionsUsemarketingListTwo, setOptionsUsemarketingListTwo] = useState(
    [] as API.OptionsKeys[],
  ); // 限制使用规则明细--枚举
  const [ENU_DMONTH_LIMIT, setENU_DMONTH_LIMIT] = useState([] as API.OptionsKeys[]); // 限制使用规则明细--枚举
  useEffect(() => {
    const arr = [];
    for (let index = 1; index <= 32; index++) {
      arr.push({
        label: index + '',
        value: index,
      });
    }
    setENU_DMONTH_LIMIT(arr);
  }, []);

  // --变化--联动
  useEffect(() => {
    if (formValue.brandName && formValue.businessType) {
      // todo: 查询模版这里通过ref校验+id
      if (isFirst.current && params.id) {
        // 编辑第一次进来不可以复默认值
        isFirst.current = false;
        return;
      }

      // 业务类型改变事件：当品牌=PHDI且业务类型=Prime权益的时候限制使用是勾选，限制使用规则明细-优惠不适用于配料勾选
      if (formValue.brandName === 'PHDI' && formValue.businessType === 'Prime权益') {
        formRef.current?.setFieldsValue({ storeIdLimit: true, useMarketing: ['CONDIMENTB'] });
        dispatch('setFormValue', { storeIdLimit: true, useMarketing: ['CONDIMENTB'] });
      }
    }
  }, [formValue.brandName, formValue.businessType]);

  // 发放渠道--变化--联动
  useEffect(() => {
    const configInfo = StorageManager.getLocalStorageSync('configInfo') || '';
    const authorization = StorageManager.getLocalStorageSync('authorization') || [];
    const arr =
      // @ts-ignore
      authorization.filter((item: any) => item.authority === 'ROLE_ModifyPersonLimitCount') || [];
    if (formValue.placeChannelId) {
      // debugger;
      // 发放渠道不在allowPersonalLimitCount配置中时需要有ROLE_ModifyPersonLimitCount角色，否则单人可领数量不可用
      // @ts-ignore
      if (configInfo.indexOf(formValue.placeChannelId) === -1 && arr.length > 0) {
        formRef.current?.setFieldsValue({
          personLimitCount: '-1',
          personLimitCountCheck: ['不限制'],
        });
        dispatch('setFormValue', { personLimitCount: '-1', personLimitCountCheck: ['不限制'] });
        setPersonLimitDisabled(true);
      } else {
        setPersonLimitDisabled(false);
      }
    }
  }, [formValue.placeChannelId]);

  const getOptionsUsemarketingList = async (type: number) => {
    const { data, code } = await queryOptionsUsemarketingList({ type });
    if (code === 200) {
      const arrOne = [] as API.OptionsKeys[];
      const arrTwo = [] as API.OptionsKeys[];
      data?.forEach((item: API.OptionsUsemarketingListItem) => {
        if (item.type === 1) {
          arrOne.push({
            label: item.ruleName,
            value: item.rule,
          });
        }
        if (item.type === 2) {
          arrTwo.push({
            label: item.ruleName,
            value: item.rule,
          });
        }
      });
      setOptionsUsemarketingListOne(arrOne);
      setOptionsUsemarketingListTwo(arrTwo);
    }
  };

  // 枚举值查询
  useEffect(() => {
    // 限制使用高级明细  // 限制使用规则明细
    getOptionsUsemarketingList(0);
  }, []);

  const handleCheckChange = (e: any, type: string) => {
    formRef.current?.setFieldValue([type], e.length > 0 ? -1 : '');
    dispatch('setFormValue', { [type]: e.length > 0 ? -1 : '' });
  };

  //  餐厅组--新增
  const handleStoreGroupValue = (storeGroupOne: string, type: string) => {
    if (isEmpty(storeGroupOne)) return;
    const couponTagBro = formRef.current?.getFieldValue([type]) || '';
    if (couponTagBro.indexOf(storeGroupOne) !== -1) return;
    formRef.current?.setFieldsValue({
      [type]: couponTagBro + `${couponTagBro.length > 0 ? ',' : ''}` + storeGroupOne,
    });
    dispatch('setFormValue', {
      [type]: couponTagBro + `${couponTagBro.length > 0 ? ',' : ''}` + storeGroupOne,
    });
  };

  //  共多少家餐厅
  const getSumCount = (storeValues: string) => {
    let number = 0;
    const arr = storeValues?.split(',') || [];
    if (arr.length > 0) {
      number = arr.length;

      if (!arr[arr.length - 1]) {
        number--;
      }
    }
    return number;
  };

  //  日期区间--新增
  const handleDateLimitValue = (dateLimitValueOne: string, dateLimitValueTwo: string) => {
    if (isEmpty(dateLimitValueOne)) return;
    let str = formRef.current?.getFieldValue('dateLimitValue') || '';
    str = str.length > 0 ? str + ',' : str + '';
    str = str + dateLimitValueOne[0] + '--' + dateLimitValueOne[1];
    formRef.current?.setFieldsValue({
      dateLimitValue: str,
      dateLimitValueOne: null,
      dateLimitValueTwo: null,
    });
    dispatch('setFormValue', {
      dateLimitValue: str,
      dateLimitValueOne: null,
      dateLimitValueTwo: null,
    });
  };

  //  日期区间--新增
  const handleTimeLimitValue = (timeLimitValueOne: string, timeLimitValueTwo: string) => {
    if (timeLimitValueOne) {
      let str = formRef.current?.getFieldValue('timeLimitValue') || '';
      str = str.length > 0 ? str + ',' : str + '';
      str =
        str +
        timeLimitValueOne[0].slice(-5, -3) +
        timeLimitValueOne[0].slice(-8, -6) +
        '--' +
        timeLimitValueOne[1].slice(-5, -3) +
        timeLimitValueOne[1].slice(-8, -6);
      formRef.current?.setFieldsValue({
        timeLimitValue: str,
        timeLimitValueOne: null,
        timeLimitValueTwo: null,
      });
      dispatch('setFormValue', {
        timeLimitValue: str,
        timeLimitValueOne: null,
        timeLimitValueTwo: null,
      });
    }
  };

  const handleRuleTypeName = (value: string) => {
    if (value === '16-指定外送费') {
      formRef.current?.setFieldsValue({
        deliveryFeeList: [
          {
            timeRange: '',
            startPoint: '',
            deliveryFee: '',
          },
        ],
      });
      dispatch('setFormValue', {
        deliveryFeeList: [
          {
            timeRange: '',
            startPoint: '',
            deliveryFee: '',
          },
        ],
      });
    }

    if (value === '07-整单满XX元，获得【产品/组合产品】支付权益（以固定价钱买商品）') {
      formRef.current?.setFieldsValue({
        returnAmount: '',
      });
      dispatch('setFormValue', {
        returnAmount: '',
      });
    }
  };

  // 限制使用规则明细--清空隐藏值和字段内容
  const handleUseMarketing = (value: string[]) => {
    if (!formValue.brandId) return;
    if (value.includes('ONLYONEB')) {
      formRef.current?.setFieldsValue({
        useMarketingMore: ['CATEB'],
      });
      dispatch('setFormValue', {
        useMarketingMore: ['CATEB'],
      });
    } else {
      formRef.current?.setFieldsValue({
        useMarketingMore: [],
      });
      dispatch('setFormValue', {
        useMarketingMore: [],
      });
    }

    // STORELIMIT--清除餐厅组和门店列表--todo
    if (!value.includes('STORELIMIT')) {
      formRef.current?.setFieldsValue({
        storegroup: '',
      });
      dispatch('setFormValue', {
        storegroup: '',
      });
    }
  };

  const handleStoreIdLimit = (e: any) => {
    if (!e.target.value) {
      formRef.current?.setFieldsValue({
        useMarketing: [],
      });
      dispatch('setFormValue', {
        useMarketing: [],
      });
    }
  };

  const subName = (useRuleTypeName: string) => {
    if (useRuleTypeName) {
      const index = useRuleTypeName.indexOf('-');
      return useRuleTypeName.substring(0, index);
    }
    return '';
  };

  const handleAllowGiving = (e: any) => {
    if (!e.target.value) {
      formRef.current?.setFieldsValue({
        givingLimit: 0,
      });
      dispatch('setFormValue', {
        givingLimit: 0,
      });
    }
  };

  const useChannelIdBro = formRef.current?.getFieldValue('useChannelId');
  const queryChannelIdBro = formRef.current?.getFieldValue('queryChannelId');

  const ToolTitle = useMemo(() => {
    const strArr: any[] = [];
    if (!isEmpty(useChannelIdBro)) {
      useChannelIdBro.forEach((item: any) => {
        const flag = OptionsChannelList.find((i: any) => i.value === item);
        if (flag) strArr.push(flag.label);
      });
    }
    return strArr.join(',');
  }, [useChannelIdBro, OptionsChannelList]);

  const ToolTitleBro = useMemo(() => {
    const strArr: any[] = [];
    if (!isEmpty(queryChannelIdBro)) {
      queryChannelIdBro.forEach((item: any) => {
        const flag = OptionsChannelList.find((i: any) => i.value === item);
        if (flag) strArr.push(flag.label);
      });
    }
    return strArr.join(',');
  }, [queryChannelIdBro, OptionsChannelList]);

  return (
    <Config.Group id="write-off" title="发放与核销规则">
      <div className={styles['wrap-body']}>
        <ProForm.Group>
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="placeType"
            label="发放方式"
            options={ENUM_PLACE_TYPE}
            placeholder="请选择"
          />
          <div style={{ position: 'relative' }}>
            <ProFormDependency name={['countCheck']}>
              {({ countCheck }) => {
                return (
                  <ProFormDigit
                    disabled={countCheck.length === 1}
                    labelCol={{ span: 8 }}
                    width={128}
                    name="count"
                    label="发放电子券数量"
                    fieldProps={{ precision: 0 }}
                    placeholder="count"
                    rules={[{ required: true, message: '不得为空' }]}
                  />
                );
              }}
            </ProFormDependency>
            <div style={{ width: 100, position: 'absolute', top: 0, right: 0 }}>
              <ProFormCheckbox.Group
                width={128}
                name="countCheck"
                layout="horizontal"
                label={null}
                options={['不限制']}
                fieldProps={{
                  onChange: (e) => handleCheckChange(e, 'count'),
                }}
              />
            </div>
          </div>
          <ProForm.Group>
            <ProFormDependency name={['personLimitCountCheck']}>
              {({ personLimitCountCheck }) => {
                return (
                  <ProFormDigit
                    disabled={personLimitCountCheck.length === 1 || personLimitDisabled}
                    labelCol={{ span: 8 }}
                    width={128}
                    name="personLimitCount"
                    label="单人可领数量"
                    fieldProps={{ precision: 0 }}
                    placeholder="personLimitCount"
                    rules={[{ required: true, message: '不得为空' }]}
                  />
                );
              }}
            </ProFormDependency>
            <div style={{ width: 100, marginLeft: -130 }}>
              <ProFormCheckbox.Group
                width={100}
                name="personLimitCountCheck"
                disabled={personLimitDisabled}
                // disabled={formValue.personLimitCountCheck.length === 1 || personLimitDisabled}
                layout="horizontal"
                label={null}
                options={['不限制']}
                fieldProps={{
                  onChange: (e) => handleCheckChange(e, 'personLimitCount'),
                }}
              />
            </div>
            <ProFormDependency name={['reusableCountCheck']}>
              {({ reusableCountCheck }) => {
                return (
                  <div style={{ marginLeft: -32 }}>
                    <ProFormDigit
                      disabled={reusableCountCheck.length === 1}
                      labelCol={{ span: 8 }}
                      width={128}
                      name="reusableCount"
                      label="每张可使用次数"
                      fieldProps={{ precision: 0 }}
                      placeholder="reusableCount"
                      rules={[{ required: true, message: '不得为空' }]}
                    />
                  </div>
                );
              }}
            </ProFormDependency>
            <div style={{ width: 100, marginLeft: -130 }}>
              <ProFormCheckbox.Group
                width={100}
                name="reusableCountCheck"
                layout="horizontal"
                label={null}
                options={['不限制']}
                fieldProps={{
                  onChange: (e) => handleCheckChange(e, 'reusableCount'),
                }}
              />
            </div>
          </ProForm.Group>
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="packageLimit"
            label="套餐限制"
            options={PACKAGELIMIT}
            placeholder="请选择"
          />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="countShowType"
            label="使用次数显示方式"
            options={ENUM_COUNT_SHOW_TYPE}
            placeholder="请选择"
          />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="priceLimit"
            label="价格规则"
            options={PRICELIMIT}
            placeholder="请选择"
          />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="orderLimit"
            label="订单限制"
            options={ORDERLIMIT}
            placeholder="请选择"
          />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="validThruRule"
            label="有效期模式"
            options={ENUM_VALID_THRU_RULE}
            placeholder="请选择"
          />
          {/* 占位 */}
          <div style={{ width: 500 }} />
          <ProFormDependency name={['validThruRule']}>
            {({ validThruRule }) => {
              if ([3, 4, 5].includes(validThruRule)) {
                return (
                  <ProFormDigit
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="delayDays"
                    label="激活后多少天/月开始有效"
                    fieldProps={{ precision: 0 }}
                    placeholder="delayDays"
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['validThruRule']}>
            {({ validThruRule }) => {
              if ([3, 4, 5].includes(validThruRule)) {
                return (
                  <ProFormDigit
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="activationDays"
                    label="有效天/月数"
                    fieldProps={{ precision: 0 }}
                    placeholder="activationDays"
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          {/* 使用规则类型***交互复杂---开始 */}
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="useRuleTypeName"
            label="使用规则类型"
            options={ENUM_USE_RULE_TYPE_NAME}
            placeholder="请选择"
            fieldProps={{
              onChange: handleRuleTypeName,
            }}
          />
          {/* 16-指定外卖费--todo--单独组件FormList */}
          <ProFormDependency name={['deliveryFeeList', 'useRuleTypeName']}>
            {({ deliveryFeeList, useRuleTypeName }) => {
              if (useRuleTypeName === '16-指定外送费') {
                return (
                  <div style={{ width: 1200 }}>
                    <FormList deliveryFeeList={deliveryFeeList} name="deliveryFeeList" />
                  </div>
                );
              }
              return null;
            }}
          </ProFormDependency>
          {/* 占位 */}
          <div style={{ width: 500 }} />
          <ProFormDependency name={['useRuleTypeName']}>
            {({ useRuleTypeName }) => {
              if (
                ['01', '03', '05', '07', '08', '09', '10', '12', '13', '17', '201'].includes(
                  subName(useRuleTypeName),
                )
              ) {
                return (
                  <ProFormDigit
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="priceRule"
                    label="满"
                    fieldProps={{ precision: 0 }}
                    placeholder="请输入"
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['useRuleTypeName']}>
            {({ useRuleTypeName }) => {
              if (
                ['01', '03', '05', '07', '08', '09', '10', '12', '13', '17', '201'].includes(
                  subName(useRuleTypeName),
                )
              ) {
                return (
                  <ProFormDigit
                    disabled={['03', '05', '07', '09', '10', '12'].includes(
                      subName(useRuleTypeName),
                    )}
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="returnAmount"
                    label="减"
                    fieldProps={{ precision: 0 }}
                    placeholder="请输入"
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          {/* 占位 */}
          <div style={{ width: 1500 }} />
          <ProFormDependency name={['useRuleTypeName']}>
            {({ useRuleTypeName }) => {
              if (['01', '03', '08', '13', '17', '201'].includes(subName(useRuleTypeName))) {
                return (
                  <ProFormDigit
                    disabled={['01', '13', '201'].includes(subName(useRuleTypeName))}
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="returnAmount"
                    label="POS结算总额"
                    fieldProps={{ precision: 0 }}
                    placeholder="请输入"
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['useRuleTypeName']}>
            {({ useRuleTypeName }) => {
              if (['06', '07', '09'].includes(subName(useRuleTypeName))) {
                return (
                  <ProFormDigit
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="discountPrice"
                    label="优惠购买价格"
                    fieldProps={{ precision: 0 }}
                    placeholder="请输入"
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['useRuleTypeName']}>
            {({ useRuleTypeName }) => {
              if (['14', '15', '18'].includes(subName(useRuleTypeName))) {
                return (
                  <ProFormDigit
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="discountPrice"
                    label="减免上限金额"
                    fieldProps={{ precision: 0 }}
                    placeholder="请输入"
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          {/* 占位 */}
          <div style={{ width: 1500 }} />
          <ProFormDependency name={['useRuleTypeName']}>
            {({ useRuleTypeName }) => {
              if (['04', '05', '10', '12', '14', '15', '18'].includes(subName(useRuleTypeName))) {
                return (
                  <ProFormDigit
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="returnDiscount"
                    label="POS结算折扣比例"
                    fieldProps={{ precision: 0, addonAfter: '%' }}
                    placeholder="请输入"
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          {/* 占位 */}
          <div style={{ width: 1500 }} />
          {/* 使用规则类型***交互复杂---结束 */}
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="salesType"
            label="Sales计算规则"
            options={ENUM_SALES_TYPE}
            placeholder="请选择"
          />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="tenderTypeDesc"
            label="结账或折扣"
            options={ENUM_TENDER_TYPE_DESC}
            placeholder="请选择"
            rules={[{ required: true, message: '不得为空' }]}
          />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="placeChannelId"
            label="发放渠道"
            options={OptionsChannelList}
            placeholder="请选择"
            rules={[{ required: true, message: '不得为空' }]}
          />
          <div style={{ position: 'relative' }}>
            <Tooltip placement="top" title={ToolTitleBro}>
              <div
                style={{
                  position: 'absolute',
                  top: 0,
                  left: 50,
                  width: 100,
                  height: 30,
                  opacity: 0,
                }}
              />
              <ProFormSelect
                mode="multiple"
                labelCol={{ span: 8 }}
                width="lg"
                name="queryChannelId"
                label="查询渠道"
                options={OptionsChannelList}
                placeholder="请选择"
                fieldProps={{
                  maxTagCount: 'responsive',
                }}
                rules={[{ required: true, message: '不得为空' }]}
              />
            </Tooltip>
          </div>

          <ProFormDependency name={['useChannelId']}>
            {({ useChannelId }) => {
              return (
                <div style={{ position: 'relative' }}>
                  <Tooltip placement="top" title={ToolTitle}>
                    <div
                      style={{
                        position: 'absolute',
                        top: 0,
                        left: 50,
                        width: 100,
                        height: 30,
                        opacity: 0,
                      }}
                    />
                    <ProFormSelect
                      // tooltip={useChannelId ? useChannelId.join(',') : '暂无数据'}
                      mode="multiple"
                      labelCol={{ span: 8 }}
                      width="lg"
                      name="useChannelId"
                      label="使用渠道"
                      options={OptionsChannelList}
                      placeholder="请选择"
                      fieldProps={{
                        maxTagCount: 'responsive',
                      }}
                      rules={[{ required: true, message: '不得为空' }]}
                    />
                  </Tooltip>
                </div>
              );
            }}
          </ProFormDependency>

          {/* 占位 */}
          <div style={{ width: 500 }} />
          <ProFormSelect
            mode="multiple"
            labelCol={{ span: 8 }}
            width="lg"
            name="useTabs"
            label="卡包栏位"
            options={OptionsUsetabList}
            placeholder="请选择"
            fieldProps={{
              maxTagCount: 'responsive',
            }}
          />
          <ProFormRadio.Group
            labelCol={{ span: 8 }}
            width="lg"
            name="storeIdLimit"
            label="限制使用"
            fieldProps={{
              onChange: handleStoreIdLimit,
            }}
            options={[
              {
                label: '否',
                value: false,
              },
              {
                label: '是',
                value: true,
              },
            ]}
          />
          <ProFormDependency name={['storeIdLimit']}>
            {({ storeIdLimit }) => {
              // if (storeIdLimit) {
              return (
                <ProFormSelect
                  disabled={!storeIdLimit}
                  mode="multiple"
                  labelCol={{ span: 8 }}
                  width="lg"
                  name="useMarketing"
                  label="限制使用规则明细"
                  options={OptionsUsemarketingListOne}
                  placeholder="请选择"
                  fieldProps={{
                    maxTagCount: 'responsive',
                    onChange: handleUseMarketing,
                  }}
                />
              );
              // }
              // return null;
            }}
          </ProFormDependency>
          <ProFormSelect
            mode="multiple"
            labelCol={{ span: 8 }}
            width="lg"
            name="useMarketingMore"
            label="限制使用高级明细"
            options={OptionsUsemarketingListTwo}
            placeholder="请选择"
            fieldProps={{
              maxTagCount: 'responsive',
            }}
          />
          {/* 占位 */}
          <div style={{ width: 1000 }} />
          {/* 限制使用规则明细***交互复杂---开始 */}
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('STORELIMIT')) {
                return (
                  <ProForm.Group>
                    <ProFormSelect
                      labelCol={{ span: 8 }}
                      width="lg"
                      name="storeGroupOne"
                      label="餐厅组"
                      placeholder="请选择"
                      options={OptionsStoreGrouplist}
                    />
                    <ProFormDependency name={['storeGroupOne']}>
                      {({ storeGroupOne }) => {
                        return (
                          <>
                            <Button
                              onClick={() => {
                                handleStoreGroupValue(storeGroupOne, 'storegroup');
                              }}
                              type="primary"
                            >
                              添加
                            </Button>
                            <Button
                              style={{ marginLeft: 16 }}
                              onClick={() => {
                                formRef.current?.setFieldValue('storegroup', '');
                                dispatch('setFormValue', { storegroup: '' });
                              }}
                              type="primary"
                            >
                              清空
                            </Button>
                          </>
                        );
                      }}
                    </ProFormDependency>
                  </ProForm.Group>
                );
              }
              return null;
            }}
          </ProFormDependency>
          <div style={{ width: 1000 }} />
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('STORELIMIT')) {
                return (
                  <ProForm.Group>
                    <div style={{ paddingLeft: 132 }}>
                      <ProFormTextArea
                        labelCol={{ span: 8 }}
                        width={700}
                        label={null}
                        name="storegroup"
                        placeholder=""
                        fieldProps={{
                          autoSize: {
                            minRows: 2,
                            maxRows: 4,
                          },
                        }}
                      />
                    </div>
                  </ProForm.Group>
                );
              }
              return null;
            }}
          </ProFormDependency>
          <div style={{ width: 1000 }} />
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('STORELIMIT')) {
                return (
                  <ProForm.Group>
                    <ProFormRadio.Group
                      layout="horizontal"
                      labelCol={{ span: 8 }}
                      width="lg"
                      name="storeLimit"
                      label="门店限制"
                      options={[
                        {
                          label: '黑名单',
                          value: 'black',
                        },
                        {
                          label: '白名单',
                          value: 'white',
                        },
                      ]}
                    />
                  </ProForm.Group>
                );
              }
              return null;
            }}
          </ProFormDependency>
          <div style={{ width: 1000 }} />
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('STORELIMIT')) {
                return (
                  <div style={{ position: 'relative' }}>
                    <ProFormDependency name={['storeValues']}>
                      {({ storeValues }) => {
                        return (
                          <ProForm.Group>
                            <>
                              <ProFormTextArea
                                labelCol={{ span: 8 }}
                                width={700}
                                name="storeValues"
                                label="门店列表"
                                placeholder="门店列表，逗号隔开"
                                fieldProps={{
                                  autoSize: {
                                    minRows: 4,
                                    maxRows: 6,
                                  },
                                  onBlur: (e) => {
                                    const value = e.target.value;
                                  },
                                }}
                              />
                              <div
                                style={{
                                  width: 200,
                                  position: 'absolute',
                                  left: 770,
                                  bottom: 0,
                                  color: 'red',
                                }}
                              >
                                共{getSumCount(storeValues)}家餐厅
                              </div>
                            </>
                          </ProForm.Group>
                        );
                      }}
                    </ProFormDependency>
                  </div>
                );
              }
              return null;
            }}
          </ProFormDependency>
          <div style={{ width: 1000 }} />
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('DATELIMIT')) {
                return (
                  <ProForm.Group>
                    <ProFormSelect
                      labelCol={{ span: 8 }}
                      width="lg"
                      name="dateGroupOne"
                      label="日期组"
                      placeholder="请选择"
                      options={OptionsDategroupList}
                    />
                    <ProFormDependency name={['dateGroupOne']}>
                      {({ dateGroupOne }) => {
                        return (
                          <>
                            <Button
                              onClick={() => {
                                // handleDateGroupValue(dateGroupOne);
                                handleStoreGroupValue(dateGroupOne, 'dateGroup');
                              }}
                              type="primary"
                            >
                              添加
                            </Button>
                            <Button
                              style={{ marginLeft: 16 }}
                              onClick={() => {
                                formRef.current?.setFieldValue('dateGroup', '');
                                dispatch('setFormValue', { dateGroup: '' });
                              }}
                              type="primary"
                            >
                              清空
                            </Button>
                          </>
                        );
                      }}
                    </ProFormDependency>
                  </ProForm.Group>
                );
              }
              return null;
            }}
          </ProFormDependency>
          <div style={{ width: 1000 }} />
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('DATELIMIT')) {
                return (
                  <ProForm.Group>
                    <div style={{ paddingLeft: 132 }}>
                      <ProFormTextArea
                        width={700}
                        label={null}
                        name="dateGroup"
                        placeholder=""
                        fieldProps={{
                          autoSize: {
                            minRows: 2,
                            maxRows: 4,
                          },
                        }}
                      />
                    </div>
                  </ProForm.Group>
                );
              }
              return null;
            }}
          </ProFormDependency>
          <div style={{ width: 1000 }} />
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('DATELIMIT')) {
                return (
                  <ProForm.Group>
                    <ProFormRadio.Group
                      layout="horizontal"
                      labelCol={{ span: 8 }}
                      width="lg"
                      name="dateLimit"
                      label="日期限制"
                      options={[
                        {
                          label: '黑名单',
                          value: 'black',
                        },
                        {
                          label: '白名单',
                          value: 'white',
                        },
                      ]}
                    />
                  </ProForm.Group>
                );
              }
              return null;
            }}
          </ProFormDependency>
          <div style={{ width: 1000 }} />
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('DATELIMIT')) {
                return <div style={{ width: 1000 }} />;
              }
              return null;
            }}
          </ProFormDependency>
          <div style={{ width: 1000 }} />
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('DATELIMIT')) {
                return (
                  <ProForm.Group>
                    <ProFormDateTimeRangePicker
                      labelCol={{ span: 8 }}
                      width={350}
                      label="日期区间范围"
                      name="dateLimitValueOne"
                      fieldProps={{ format: 'YYYY-MM-DD HH:mm:ss' }}
                    />
                    {/* <ProFormDateTimePicker
                      labelCol={{ span: 8 }}
                      width="md"
                      label="开始时间"
                      name="dateLimitValueOne"
                      fieldProps={{ format: 'YYYY-MM-DD HH:mm:ss' }}
                    />
                    <ProFormDateTimePicker
                      labelCol={{ span: 8 }}
                      width="md"
                      label="结束时间"
                      name="dateLimitValueTwo"
                      fieldProps={{ format: 'YYYY-MM-DD HH:mm:ss' }}
                    /> */}
                    <ProFormDependency name={['dateLimitValueOne', 'dateLimitValueTwo']}>
                      {({ dateLimitValueOne, dateLimitValueTwo }) => {
                        return (
                          <>
                            <Button
                              style={{ marginLeft: 80 }}
                              onClick={() => {
                                handleDateLimitValue(dateLimitValueOne, dateLimitValueTwo);
                              }}
                              type="primary"
                            >
                              添加
                            </Button>
                            <Button
                              style={{ marginLeft: 16 }}
                              onClick={() => {
                                formRef.current?.setFieldValue('dateLimitValue', '');
                                dispatch('setFormValue', { dateLimitValue: '' });
                              }}
                              type="primary"
                            >
                              清空
                            </Button>
                          </>
                        );
                      }}
                    </ProFormDependency>
                  </ProForm.Group>
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('DATELIMIT')) {
                return (
                  <ProFormTextArea
                    labelCol={{ span: 8 }}
                    width={700}
                    label="日期区间"
                    name="dateLimitValue"
                    placeholder=""
                    fieldProps={{
                      autoSize: {
                        minRows: 2,
                        maxRows: 4,
                      },
                    }}
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          <div style={{ width: 1000 }} />
          {/* 时间限制--开始 */}
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('TIMELIMIT')) {
                return (
                  <ProFormRadio.Group
                    layout="horizontal"
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="timeLimit"
                    label="时间限制"
                    options={[
                      {
                        label: '黑名单',
                        value: 'black',
                      },
                      {
                        label: '白名单',
                        value: 'white',
                      },
                    ]}
                    rules={[{ required: true, message: '不得为空' }]}
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('TIMELIMIT')) {
                return <div style={{ width: 1000 }} />;
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('TIMELIMIT')) {
                return (
                  <ProForm.Group>
                    <ProFormTimePicker.RangePicker
                      labelCol={{ span: 8 }}
                      // width={260}
                      width="lg"
                      label="时间区间范围"
                      name="timeLimitValueOne"
                      fieldProps={{ format: 'HH:mm' }}
                    />
                    {/* <ProFormText
                      labelCol={{ span: 8 }}
                      width="md"
                      name="timeLimitValueOne"
                      label="起始时间"
                      placeholder="请输入"
                      tooltip="时间填写格式为HHmm,例如12点15分=1215"
                    />
                    <ProFormText
                      labelCol={{ span: 8 }}
                      width="md"
                      name="timeLimitValueTwo"
                      label="结束时间"
                      placeholder="请输入"
                    /> */}
                    <ProFormDependency name={['timeLimitValueOne', 'timeLimitValueTwo']}>
                      {({ timeLimitValueOne, timeLimitValueTwo }) => {
                        return (
                          <>
                            <Button
                              onClick={() => {
                                handleTimeLimitValue(timeLimitValueOne, timeLimitValueTwo);
                              }}
                              type="primary"
                            >
                              添加
                            </Button>
                            <Button
                              style={{ marginLeft: 16 }}
                              onClick={() => {
                                formRef.current?.setFieldValue('timeLimitValue', '');
                                dispatch('setFormValue', { timeLimitValue: '' });
                              }}
                              type="primary"
                            >
                              清空
                            </Button>
                          </>
                        );
                      }}
                    </ProFormDependency>
                  </ProForm.Group>
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('TIMELIMIT')) {
                return (
                  <ProFormTextArea
                    labelCol={{ span: 8 }}
                    width={700}
                    label="时间区间"
                    name="timeLimitValue"
                    placeholder=""
                    fieldProps={{
                      autoSize: {
                        minRows: 2,
                        maxRows: 4,
                      },
                    }}
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('DWEEKLIMIT')) {
                return (
                  <ProForm.Group>
                    <ProFormRadio.Group
                      layout="horizontal"
                      labelCol={{ span: 8 }}
                      width="lg"
                      name="dweekLimit"
                      label="星期限制"
                      options={[
                        {
                          label: '黑名单',
                          value: 'black',
                        },
                        {
                          label: '白名单',
                          value: 'white',
                        },
                      ]}
                      rules={[{ required: true, message: '不得为空' }]}
                    />
                    {/* 占位 */}
                    <div style={{ width: 1000 }} />
                  </ProForm.Group>
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('DWEEKLIMIT')) {
                return (
                  <>
                    <ProFormSelect
                      mode="multiple"
                      labelCol={{ span: 8 }}
                      width="lg"
                      name="dweekLimitValue"
                      label="限制DWeek"
                      options={ENU_DWEEK_LIMIT}
                      placeholder="请选择"
                      fieldProps={{
                        maxTagCount: 'responsive',
                      }}
                    />
                    {/* 占位 */}
                    <div style={{ width: 1000 }} />
                  </>
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('DMONTHLIMIT')) {
                return (
                  <>
                    <ProFormRadio.Group
                      layout="horizontal"
                      labelCol={{ span: 8 }}
                      width="lg"
                      name="dmonthLimit"
                      label="天数限制"
                      options={[
                        {
                          label: '黑名单',
                          value: 'black',
                        },
                        {
                          label: '白名单',
                          value: 'white',
                        },
                      ]}
                      rules={[{ required: true, message: '不得为空' }]}
                    />
                    {/* 占位 */}
                    <div style={{ width: 1000 }} />
                  </>
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('DMONTHLIMIT')) {
                return (
                  <>
                    <ProFormSelect
                      mode="multiple"
                      labelCol={{ span: 8 }}
                      width="lg"
                      name="dmonthLimitValue"
                      label="限制DMonth"
                      options={ENU_DMONTH_LIMIT}
                      placeholder="请选择"
                      fieldProps={{
                        maxTagCount: 'responsive',
                      }}
                    />
                    {/* 占位 */}
                    <div style={{ width: 1000 }} />
                  </>
                );
              }
              return null;
            }}
          </ProFormDependency>
          <div style={{ width: 1000 }} />
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('REUSABLECOUNTLIMIT')) {
                return (
                  <ProFormSelect
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="reusableType"
                    label="模式"
                    options={REUSAVLETYPE}
                    placeholder="请选择"
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('REUSABLECOUNTLIMIT')) {
                return (
                  <ProFormDigit
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="reusableCountValue"
                    label="使用次数"
                    fieldProps={{ precision: 0 }}
                    placeholder="reusableCountValue"
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>

          {/* 限制使用规则明细***交互复杂---结束 */}
          <div style={{ width: 1500 }} />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="isDynamicCoupon"
            label="是否动态券码"
            options={ENUM_IS_DYNAMIC_COUPON}
            placeholder="请选择"
          />
          <ProFormRadio.Group
            labelCol={{ span: 8 }}
            width="lg"
            name="allowGiving"
            label="是否允许转赠"
            options={[
              {
                label: '否',
                value: false,
              },
              {
                label: '是',
                value: true,
              },
            ]}
            fieldProps={{
              onChange: handleAllowGiving,
            }}
          />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="isExpanded"
            label="是否延期券"
            options={ENUM_IS_EXPANDED}
            placeholder="请选择"
          />
          <ProFormDigit
            labelCol={{ span: 8 }}
            width="lg"
            name="givingLimit"
            label="转赠次数"
            fieldProps={{ precision: 0 }}
            placeholder="givingLimit"
          />
          <ProFormDigit
            labelCol={{ span: 8 }}
            width="lg"
            name="givingOutInLimit"
            label="转赠上限次数"
            fieldProps={{ precision: 0 }}
            placeholder="givingOutInLimit"
          />
          <ProFormDigit
            labelCol={{ span: 8 }}
            // width={300}
            style={{ width: '100%' }}
            name="givingCouponLeftTime"
            label="转赠时效"
            fieldProps={{ precision: 0, addonAfter: '秒' }}
            placeholder="givingCouponLeftTime"
          />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="placeRule"
            label="发放特殊处理"
            options={ENU_PLACE_RULE}
            placeholder="请选择"
          />
          <ProFormText
            labelCol={{ span: 8 }}
            width="lg"
            name="placeActivityIds"
            label="特殊发放活动号"
            placeholder="placeActivityIds"
          />
          <ProFormSelect
            mode="multiple"
            labelCol={{ span: 8 }}
            width="lg"
            name="notifyRuleNames"
            label="规则名称"
            options={OptionsNotifyRuleList}
            placeholder="notifyRuleNames"
            fieldProps={{
              maxTagCount: 'responsive',
            }}
          />
          <ProFormDependency name={['useMarketing']}>
            {({ useMarketing }) => {
              if (useMarketing.includes('INTERVALW') || useMarketing.includes('INTERVALFIRSTW')) {
                return (
                  <ProFormDigit
                    labelCol={{ span: 8 }}
                    // width="lg"
                    // width={128}
                    style={{ width: '100%' }}
                    name="redeemInterval"
                    label="核销时间间隔"
                    fieldProps={{ precision: 0, addonAfter: '秒' }}
                    placeholder="redeemInterval"
                  />
                );
              }
              /* 占位 */
              return <div style={{ width: 500 }} />;
            }}
          </ProFormDependency>
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="offerReset"
            label="重置周期"
            options={OFFERRESET}
            placeholder="请选择"
          />
          <ProFormDigit
            labelCol={{ span: 8 }}
            width="lg"
            name="offerResetCount"
            label="重置次数"
            fieldProps={{ precision: 0 }}
            placeholder="offerResetCount"
          />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="isrealtime"
            label="实时返回商城"
            options={ENU_IS_REAL_TIME}
            placeholder="请选择"
          />
          {/* 占位 */}
          <div style={{ width: 500 }} />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="isdynamiccount"
            label="是否动态次数"
            options={ENU_IS_REAL_TIME}
            placeholder="请选择"
          />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="isgivingonebyone"
            label="转赠单次转赠领用"
            options={ENU_IS_REAL_TIME}
            placeholder="请选择"
          />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="needSyncBooking"
            label="同步预约系统"
            options={ENU_IS_REAL_TIME}
            placeholder="请选择"
          />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="needCheckBooking"
            label="校验预约信息"
            options={ENU_IS_REAL_TIME}
            placeholder="请选择"
          />
          <ProFormDependency name={['isExpanded']}>
            {({ isExpanded }) => {
              if (isExpanded === 1) {
                return (
                  <ProFormDigit
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="expandedStartDays"
                    label="最近的天数"
                    fieldProps={{ precision: 0 }}
                    placeholder="expandedStartDays"
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['isExpanded']}>
            {({ isExpanded }) => {
              if (isExpanded === 1) {
                return (
                  <ProFormDigit
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="expandedDays"
                    label="每次延展的天数"
                    fieldProps={{ precision: 0 }}
                    placeholder="expandedDays"
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="crossBrandPlace"
            label="是否跨品牌发放"
            options={ENU_CROSS_BRAND_PLACE}
            placeholder="请选择"
          />
          {/* 占位 */}
          <div style={{ width: 500 }} />
          <ProFormDependency name={['crossBrandPlace']}>
            {({ crossBrandPlace }) => {
              if (crossBrandPlace === 1) {
                return (
                  <ProFormSelect
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="placeBrand"
                    label="发放品牌"
                    options={OptionsPlaceBrandList}
                    placeholder="请选择"
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['crossBrandPlace']}>
            {({ crossBrandPlace }) => {
              if (crossBrandPlace === 1) {
                return (
                  <ProFormSelect
                    mode="multiple"
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="crossBrands"
                    label="同步品牌"
                    options={OptionsPlaceBrandList}
                    placeholder="请选择"
                    fieldProps={{
                      maxTagCount: 'responsive',
                    }}
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['crossBrandPlace']}>
            {({ crossBrandPlace }) => {
              if (crossBrandPlace === 2) {
                return (
                  <ProFormText
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="crossActivity"
                    label="多品牌卡包活动号"
                    placeholder="crossActivity"
                    rules={[
                      {
                        validator: (_, value) => {
                          if (isEmpty(value)) return Promise.reject('不得为空');
                          return Promise.resolve();
                        },
                      },
                    ]}
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          {/* 占位 */}
          <div style={{ width: 1500 }} />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="needBookCoupon"
            label="是否生成预约券"
            options={ENU_IS_REAL_TIME}
            placeholder="请选择"
          />
          <ProFormSelect
            mode="multiple"
            labelCol={{ span: 8 }}
            width="lg"
            name="bookChannelIds"
            label="预约渠道号"
            options={OptionsChannelList}
            placeholder="请选择"
            fieldProps={{
              maxTagCount: 'responsive',
            }}
          />
          <ProFormDependency name={['needBookCoupon']}>
            {({ needBookCoupon }) => {
              if (needBookCoupon === 1) {
                return (
                  <>
                    <ProFormTextArea
                      labelCol={{ span: 8 }}
                      width={700}
                      name="bookActivityIds"
                      label="预约券活动id"
                      placeholder="预约券活动id，一行一个activityId"
                      fieldProps={{
                        autoSize: {
                          minRows: 4,
                          maxRows: 6,
                        },
                      }}
                    />
                  </>
                );
              }
              return null;
            }}
          </ProFormDependency>
          <div style={{ width: 1500 }} />
          <ProFormDependency name={['needBookCoupon']}>
            {({ needBookCoupon }) => {
              if (needBookCoupon === 1) {
                return (
                  <ProFormSelect
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="preloadChannelId"
                    label="预加载渠道号"
                    options={OptionsChannelList}
                    placeholder="请选择"
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormDependency name={['needBookCoupon']}>
            {({ needBookCoupon }) => {
              if (needBookCoupon === 1) {
                return (
                  <ProFormDigit
                    labelCol={{ span: 8 }}
                    width="lg"
                    name="preloadSeconds"
                    label="预加载缓存时间（秒）"
                    fieldProps={{ precision: 0 }}
                    placeholder="preloadSeconds"
                  />
                );
              }
              return null;
            }}
          </ProFormDependency>
          <ProFormSelect
            mode="multiple"
            labelCol={{ span: 8 }}
            width="lg"
            name="tapChannelIds"
            label="卡包阀门渠道号"
            options={OptionsChannelList}
            placeholder="请选择"
            fieldProps={{
              maxTagCount: 'responsive',
            }}
          />
          <div style={{ width: 1500 }} />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="zmType"
            label="子母店类型"
            placeholder="请选择"
            options={ZMTYPE}
          />
          <ProFormSelect
            labelCol={{ span: 8 }}
            width="lg"
            name="sType"
            label="门店类型"
            placeholder="请选择"
            options={STYPE}
          />
        </ProForm.Group>
      </div>
    </Config.Group>
  );
};

export default WriteOff;
